<!-- HTML header for doxygen 1.8.20-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=9"/>
	<meta name="generator" content="Doxygen 1.9.4"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<title>Raspberry Pi Pico SDK: pico_stdlib</title>
	<!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="dynsections.js"></script>
	<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
	<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
	<link href="doxygen.css" rel="stylesheet" type="text/css" />
	<link href="normalise.css" rel="stylesheet" type="text/css"/>
<link href="main.css" rel="stylesheet" type="text/css"/>
<link href="styles.css" rel="stylesheet" type="text/css"/>
</head>
<body>
	<div class="navigation-mobile">
		<div class="logo--mobile">
			<a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
		</div>
		<div class="navigation-toggle">
			<span class="line-1"></span>
			<span class="line-2">
				<p>Menu Toggle</p>
			</span>
			<span class="line-3"></span>
		</div>
	</div>
	<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
		<div class="logo">
			<a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
			<span style="display: inline-block; margin-top: 10px;">
				v2.0.0
			</span>
		</div>
		<div class="navigation-footer">
			<img src="logo-mobile.svg" alt="Raspberry Pi">
			<a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
		</div>
<!-- 		<div class="search">
			<form>
				<input type="search" name="search" id="search" placeholder="Search">
				<input type="submit" value="Search">
			</form>
		</div> -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__pico__stdlib.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">pico_stdlib<div class="ingroups"><a class="el" href="group__high__level.html">High Level APIs</a></div></div></div>
</div><!--header-->
<div class="contents">

<p>Aggregation of a core subset of Raspberry Pi Pico SDK libraries used by most executables along with some additional utility methods.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gacf31cd777510116d829aea040b034c4c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pico__stdlib.html#gacf31cd777510116d829aea040b034c4c">setup_default_uart</a> (void)</td></tr>
<tr class="memdesc:gacf31cd777510116d829aea040b034c4c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set up the default UART and assign it to the default GPIOs.  <a href="group__pico__stdlib.html#gacf31cd777510116d829aea040b034c4c">More...</a><br /></td></tr>
<tr class="separator:gacf31cd777510116d829aea040b034c4c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga89efe34eab0b8b96954eb0e19a38c8be"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pico__stdlib.html#ga89efe34eab0b8b96954eb0e19a38c8be">set_sys_clock_48mhz</a> (void)</td></tr>
<tr class="memdesc:ga89efe34eab0b8b96954eb0e19a38c8be"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialise the system clock to 48MHz.  <a href="group__pico__stdlib.html#ga89efe34eab0b8b96954eb0e19a38c8be">More...</a><br /></td></tr>
<tr class="separator:ga89efe34eab0b8b96954eb0e19a38c8be"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga44d5e0845d4f75f3b0c97c733e39f4c8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pico__stdlib.html#ga44d5e0845d4f75f3b0c97c733e39f4c8">set_sys_clock_pll</a> (uint32_t vco_freq, uint post_div1, uint post_div2)</td></tr>
<tr class="memdesc:ga44d5e0845d4f75f3b0c97c733e39f4c8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialise the system clock.  <a href="group__pico__stdlib.html#ga44d5e0845d4f75f3b0c97c733e39f4c8">More...</a><br /></td></tr>
<tr class="separator:ga44d5e0845d4f75f3b0c97c733e39f4c8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafa509e1c42d351a21ac87a790d7c37e0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pico__stdlib.html#gafa509e1c42d351a21ac87a790d7c37e0">check_sys_clock_hz</a> (uint32_t freq_hz, uint *vco_freq_out, uint *post_div1_out, uint *post_div2_out)</td></tr>
<tr class="memdesc:gafa509e1c42d351a21ac87a790d7c37e0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a given system clock frequency is valid/attainable.  <a href="group__pico__stdlib.html#gafa509e1c42d351a21ac87a790d7c37e0">More...</a><br /></td></tr>
<tr class="separator:gafa509e1c42d351a21ac87a790d7c37e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8553a9d91b581e0d3dbccd8d83b1a1b9"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pico__stdlib.html#ga8553a9d91b581e0d3dbccd8d83b1a1b9">check_sys_clock_khz</a> (uint32_t freq_khz, uint *vco_freq_out, uint *post_div1_out, uint *post_div2_out)</td></tr>
<tr class="memdesc:ga8553a9d91b581e0d3dbccd8d83b1a1b9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a given system clock frequency is valid/attainable.  <a href="group__pico__stdlib.html#ga8553a9d91b581e0d3dbccd8d83b1a1b9">More...</a><br /></td></tr>
<tr class="separator:ga8553a9d91b581e0d3dbccd8d83b1a1b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga28d65a360d9c9423fe5549b216b79683"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pico__stdlib.html#ga28d65a360d9c9423fe5549b216b79683">set_sys_clock_hz</a> (uint32_t freq_hz, bool required)</td></tr>
<tr class="memdesc:ga28d65a360d9c9423fe5549b216b79683"><td class="mdescLeft">&#160;</td><td class="mdescRight">Attempt to set a system clock frequency in hz.  <a href="group__pico__stdlib.html#ga28d65a360d9c9423fe5549b216b79683">More...</a><br /></td></tr>
<tr class="separator:ga28d65a360d9c9423fe5549b216b79683"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab3a273e837ba1947bb5fd8fc97cf47e5"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pico__stdlib.html#gab3a273e837ba1947bb5fd8fc97cf47e5">set_sys_clock_khz</a> (uint32_t freq_khz, bool required)</td></tr>
<tr class="memdesc:gab3a273e837ba1947bb5fd8fc97cf47e5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Attempt to set a system clock frequency in khz.  <a href="group__pico__stdlib.html#gab3a273e837ba1947bb5fd8fc97cf47e5">More...</a><br /></td></tr>
<tr class="separator:gab3a273e837ba1947bb5fd8fc97cf47e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p >Aggregation of a core subset of Raspberry Pi Pico SDK libraries used by most executables along with some additional utility methods. </p>
<p >Including pico_stdlib gives you everything you need to get a basic program running which prints to stdout or flashes a LED</p>
<p >This library aggregates:</p><ul>
<li><a class="el" href="group__hardware__divider.html">hardware_divider</a></li>
<li><a class="el" href="group__hardware__gpio.html">hardware_gpio</a></li>
<li><a class="el" href="group__hardware__uart.html">hardware_uart</a></li>
<li><a class="el" href="group__pico__runtime.html">pico_runtime</a></li>
<li><a class="el" href="group__pico__platform.html">pico_platform</a></li>
<li><a class="el" href="group__pico__stdio.html">pico_stdio</a></li>
<li><a class="el" href="group__pico__time.html">pico_time</a></li>
<li><a class="el" href="group__pico__util.html">pico_util</a></li>
</ul>
<p >There are some basic default values used by these functions that will default to usable values, however, they can be customised in a board definition header via config.h or similar </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="gafa509e1c42d351a21ac87a790d7c37e0" name="gafa509e1c42d351a21ac87a790d7c37e0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafa509e1c42d351a21ac87a790d7c37e0">&#9670;&nbsp;</a></span>check_sys_clock_hz()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool check_sys_clock_hz </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>freq_hz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint *&#160;</td>
          <td class="paramname"><em>vco_freq_out</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint *&#160;</td>
          <td class="paramname"><em>post_div1_out</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint *&#160;</td>
          <td class="paramname"><em>post_div2_out</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Check if a given system clock frequency is valid/attainable. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">freq_hz</td><td>Requested frequency </td></tr>
    <tr><td class="paramname">vco_freq_out</td><td>On success, the voltage controlled oscillator frequency to be used by the SYS PLL </td></tr>
    <tr><td class="paramname">post_div1_out</td><td>On success, The first post divider for the SYS PLL </td></tr>
    <tr><td class="paramname">post_div2_out</td><td>On success, The second post divider for the SYS PLL. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if the frequency is possible and the output parameters have been written. </dd></dl>

</div>
</div>
<a id="ga8553a9d91b581e0d3dbccd8d83b1a1b9" name="ga8553a9d91b581e0d3dbccd8d83b1a1b9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8553a9d91b581e0d3dbccd8d83b1a1b9">&#9670;&nbsp;</a></span>check_sys_clock_khz()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool check_sys_clock_khz </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>freq_khz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint *&#160;</td>
          <td class="paramname"><em>vco_freq_out</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint *&#160;</td>
          <td class="paramname"><em>post_div1_out</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint *&#160;</td>
          <td class="paramname"><em>post_div2_out</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Check if a given system clock frequency is valid/attainable. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">freq_khz</td><td>Requested frequency </td></tr>
    <tr><td class="paramname">vco_freq_out</td><td>On success, the voltage controlled oscillator frequency to be used by the SYS PLL </td></tr>
    <tr><td class="paramname">post_div1_out</td><td>On success, The first post divider for the SYS PLL </td></tr>
    <tr><td class="paramname">post_div2_out</td><td>On success, The second post divider for the SYS PLL. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if the frequency is possible and the output parameters have been written. </dd></dl>

</div>
</div>
<a id="ga89efe34eab0b8b96954eb0e19a38c8be" name="ga89efe34eab0b8b96954eb0e19a38c8be"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga89efe34eab0b8b96954eb0e19a38c8be">&#9670;&nbsp;</a></span>set_sys_clock_48mhz()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void set_sys_clock_48mhz </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialise the system clock to 48MHz. </p>
<p >Set the system clock to 48MHz, and set the peripheral clock to match. </p>

</div>
</div>
<a id="ga28d65a360d9c9423fe5549b216b79683" name="ga28d65a360d9c9423fe5549b216b79683"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga28d65a360d9c9423fe5549b216b79683">&#9670;&nbsp;</a></span>set_sys_clock_hz()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool set_sys_clock_hz </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>freq_hz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>required</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Attempt to set a system clock frequency in hz. </p>
<p >Note that not all clock frequencies are possible; it is preferred that you use src/rp2_common/hardware_clocks/scripts/vcocalc.py to calculate the parameters for use with set_sys_clock_pll</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">freq_hz</td><td>Requested frequency </td></tr>
    <tr><td class="paramname">required</td><td>if true then this function will assert if the frequency is not attainable. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if the clock was configured </dd></dl>

</div>
</div>
<a id="gab3a273e837ba1947bb5fd8fc97cf47e5" name="gab3a273e837ba1947bb5fd8fc97cf47e5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab3a273e837ba1947bb5fd8fc97cf47e5">&#9670;&nbsp;</a></span>set_sys_clock_khz()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool set_sys_clock_khz </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>freq_khz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>required</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Attempt to set a system clock frequency in khz. </p>
<p >Note that not all clock frequencies are possible; it is preferred that you use src/rp2_common/hardware_clocks/scripts/vcocalc.py to calculate the parameters for use with set_sys_clock_pll</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">freq_khz</td><td>Requested frequency </td></tr>
    <tr><td class="paramname">required</td><td>if true then this function will assert if the frequency is not attainable. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if the clock was configured </dd></dl>

</div>
</div>
<a id="ga44d5e0845d4f75f3b0c97c733e39f4c8" name="ga44d5e0845d4f75f3b0c97c733e39f4c8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga44d5e0845d4f75f3b0c97c733e39f4c8">&#9670;&nbsp;</a></span>set_sys_clock_pll()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void set_sys_clock_pll </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>vco_freq</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>post_div1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>post_div2</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialise the system clock. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">vco_freq</td><td>The voltage controller oscillator frequency to be used by the SYS PLL </td></tr>
    <tr><td class="paramname">post_div1</td><td>The first post divider for the SYS PLL </td></tr>
    <tr><td class="paramname">post_div2</td><td>The second post divider for the SYS PLL.</td></tr>
  </table>
  </dd>
</dl>
<p>See the PLL documentation in the datasheet for details of driving the PLLs. </p>

</div>
</div>
<a id="gacf31cd777510116d829aea040b034c4c" name="gacf31cd777510116d829aea040b034c4c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacf31cd777510116d829aea040b034c4c">&#9670;&nbsp;</a></span>setup_default_uart()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void setup_default_uart </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set up the default UART and assign it to the default GPIOs. </p>
<p >By default this will use UART 0, with TX to pin GPIO 0, RX to pin GPIO 1, and the baudrate to 115200</p>
<p >Calling this method also initializes stdin/stdout over UART if the <a class="el" href="group__pico__stdio__uart.html">pico_stdio_uart</a> library is linked.</p>
<p >Defaults can be changed using configuration defines, PICO_DEFAULT_UART_INSTANCE, PICO_DEFAULT_UART_BAUD_RATE PICO_DEFAULT_UART_TX_PIN PICO_DEFAULT_UART_RX_PIN </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->

	<script src="main.js"></script>
</body>
</html>